home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / m79amb.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  6KB  |  202 lines

  1. /* Ramtek M79 Ambush */
  2.  
  3. #include "driver.h"
  4. #include "vidhrdw/generic.h"
  5. /*
  6.  * in
  7.  * 8000 DIP SW
  8.  * 8002 D0=VBlank
  9.  * 8004
  10.  * 8005
  11.  *
  12.  * out
  13.  * 8000
  14.  * 8001 Mask Sel
  15.  * 8002
  16.  * 8003 D0=SelfTest LED
  17.  *
  18.  */
  19.  
  20. WRITE_HANDLER( ramtek_videoram_w );
  21.  
  22. int  invaders_interrupt(void);
  23. void ramtek_sh_update(void);
  24. WRITE_HANDLER( ramtek_mask_w );
  25.  
  26. /*
  27.  * since these functions aren't used anywhere else, i've made them
  28.  * static, and included them here
  29.  */
  30. static const int ControllerTable[32] = {
  31.     0  , 1  , 3  , 2  , 6  , 7  , 5  , 4  ,
  32.     12 , 13 , 15 , 14 , 10 , 11 , 9  , 8  ,
  33.     24 , 25 , 27 , 26 , 30 , 31 , 29 , 28 ,
  34.     20 , 21 , 23 , 22 , 18 , 19 , 17 , 16
  35. };
  36.  
  37. static READ_HANDLER( gray5bit_controller0_r )
  38. {
  39.     return (input_port_2_r(0) & 0xe0) | (~ControllerTable[input_port_2_r(0) & 0x1f] & 0x1f);
  40. }
  41.  
  42. static READ_HANDLER( gray5bit_controller1_r )
  43. {
  44.     return (input_port_3_r(0) & 0xe0) | (~ControllerTable[input_port_3_r(0) & 0x1f] & 0x1f);
  45. }
  46.  
  47. static struct MemoryReadAddress readmem[] =
  48. {
  49.     { 0x0000, 0x1fff, MRA_ROM },
  50.     { 0x4000, 0x63ff, MRA_RAM },
  51.     { 0x8000, 0x8000, input_port_0_r},
  52.     { 0x8002, 0x8002, input_port_1_r},
  53.     { 0x8004, 0x8004, gray5bit_controller0_r},
  54.     { 0x8005, 0x8005, gray5bit_controller1_r},
  55.     { 0xC000, 0xC07f, MRA_RAM},            /* ?? */
  56.     { 0xC200, 0xC27f, MRA_RAM},            /* ?? */
  57.     { -1 }  /* end of table */
  58. };
  59.  
  60. WRITE_HANDLER( sound_w )
  61. {
  62. }
  63.  
  64. static struct MemoryWriteAddress writemem[] =
  65. {
  66.     { 0x0000, 0x1fff, MWA_ROM },
  67.     { 0x4000, 0x43ff, MWA_RAM },
  68.     { 0x4400, 0x5fff, ramtek_videoram_w, &videoram },
  69.     { 0x6000, 0x63ff, MWA_RAM },        /* ?? */
  70.     { 0x8001, 0x8001, ramtek_mask_w},
  71.     { 0x8000, 0x8000, sound_w },
  72.     { 0x8002, 0x8003, sound_w },
  73.     { 0xC000, 0xC07f, MWA_RAM},            /* ?? */
  74.     { 0xC200, 0xC27f, MWA_RAM},            /* ?? */
  75.     { -1 }  /* end of table */
  76. };
  77.  
  78.  
  79. INPUT_PORTS_START( m79amb )
  80.     PORT_START      /* 8000 */
  81.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* dip switch */
  82.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
  83.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  84.     PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNUSED )
  85.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
  86.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
  87.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
  88.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
  89.  
  90.     PORT_START      /* 8002 */
  91.     PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_VBLANK )
  92.     PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_START1 )
  93.     PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_COIN1  )
  94.     PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_TILT   )
  95.     PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNUSED )
  96.     PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
  97.     PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
  98.     PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
  99.  
  100.     PORT_START        /* 8004 */
  101.     PORT_ANALOG( 0x1f, 0x10, IPT_PADDLE, 25, 10, 0, 0x1f)
  102.     PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_BUTTON1 )
  103.     PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
  104.     PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
  105.  
  106.     PORT_START      /* 8005 */
  107.     PORT_ANALOG( 0x1f, 0x10, IPT_PADDLE | IPF_PLAYER2, 25, 10, 0, 0x1f)
  108.     PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_BUTTON2 )
  109.     PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
  110.     PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
  111.  
  112. INPUT_PORTS_END
  113.  
  114.  
  115. static unsigned char palette[] = /* V.V */ /* Smoothed pure colors, overlays are not so contrasted */
  116. {
  117.     0x00,0x00,0x00, /* BLACK */
  118.     0xff,0xff,0xff, /* WHITE */
  119.     0xff,0x20,0x20, /* RED */
  120.     0x20,0xff,0x20, /* GREEN */
  121.     0xff,0xff,0x20, /* YELLOW */
  122.     0x20,0xff,0xff, /* CYAN */
  123.     0xff,0x20,0xff  /* PURPLE */
  124. };
  125.  
  126. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  127. {
  128.     memcpy(game_palette,palette,sizeof(palette));
  129. }
  130.  
  131. static int M79_interrupt(void)
  132. {
  133.     return 0x00cf;  /* RST 08h */
  134. }
  135.  
  136. static void init_m79amb(void)
  137. {
  138.     unsigned char *rom = memory_region(REGION_CPU1);
  139.     int i;
  140.  
  141.     /* PROM data is active low */
  142.      for (i = 0;i < 0x2000;i++)
  143.         rom[i] = ~rom[i];
  144. }
  145.  
  146. static struct MachineDriver machine_driver_m79amb =
  147. {
  148.     /* basic machine hardware */
  149.     {
  150.         {
  151.             CPU_8080,
  152.             1996800,
  153.             readmem,writemem,0,0,
  154.             M79_interrupt, 1
  155.         }
  156.     },
  157.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,  /* frames per second, vblank duration */
  158.     1,      /* single CPU, no need for interleaving */
  159.     0,
  160.  
  161.     /* video hardware */
  162.     32*8, 28*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
  163.     0,      /* no gfxdecodeinfo - bitmapped display */
  164.     sizeof(palette) / sizeof(palette[0]) / 3, 0,
  165.     init_palette,
  166.  
  167.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
  168.     0,
  169.     generic_bitmapped_vh_start,
  170.     generic_bitmapped_vh_stop,
  171.     generic_bitmapped_vh_screenrefresh,
  172.  
  173.     /* sound hardware */
  174.     0,0,0,0
  175. };
  176.  
  177.  
  178.  
  179. ROM_START( m79amb )
  180.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  181.     ROM_LOAD( "m79.10t",      0x0000, 0x0200, 0xccf30b1e )
  182.     ROM_LOAD( "m79.9t",       0x0200, 0x0200, 0xdaf807dd )
  183.     ROM_LOAD( "m79.8t",       0x0400, 0x0200, 0x79fafa02 )
  184.     ROM_LOAD( "m79.7t",       0x0600, 0x0200, 0x06f511f8 )
  185.     ROM_LOAD( "m79.6t",       0x0800, 0x0200, 0x24634390 )
  186.     ROM_LOAD( "m79.5t",       0x0a00, 0x0200, 0x95252aa6 )
  187.     ROM_LOAD( "m79.4t",       0x0c00, 0x0200, 0x54cffb0f )
  188.     ROM_LOAD( "m79.3ta",      0x0e00, 0x0200, 0x27db5ede )
  189.     ROM_LOAD( "m79.10u",      0x1000, 0x0200, 0xe41d13d2 )
  190.     ROM_LOAD( "m79.9u",       0x1200, 0x0200, 0xe35f5616 )
  191.     ROM_LOAD( "m79.8u",       0x1400, 0x0200, 0x14eafd7c )
  192.     ROM_LOAD( "m79.7u",       0x1600, 0x0200, 0xb9864f25 )
  193.     ROM_LOAD( "m79.6u",       0x1800, 0x0200, 0xdd25197f )
  194.     ROM_LOAD( "m79.5u",       0x1a00, 0x0200, 0x251545e2 )
  195.     ROM_LOAD( "m79.4u",       0x1c00, 0x0200, 0xb5f55c75 )
  196.     ROM_LOAD( "m79.3u",       0x1e00, 0x0200, 0xe968691a )
  197. ROM_END
  198.  
  199.  
  200.  
  201. GAME( 1977, m79amb, 0, m79amb, m79amb, m79amb, ROT0, "Ramtek", "M79 Ambush" )
  202.